home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / birailToolScript.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  6.8 KB  |  234 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  14 January 1999
  22. // Author:         sw
  23. //
  24. //
  25. //  Procedure Name:
  26. //      birail1ToolScript
  27. //
  28. //  Input Arguments:
  29. //      what is going to happen when this script is called
  30. //        $setToTool = 0 ==> do the command
  31. //        $setToTool = 1 ==> show option box
  32. //        $setToTool = 2 ==> return the command
  33. //        $setToTool = 3 ==> show tool option box
  34. //        $setToTool = 4 ==> enter the tool
  35. //
  36. //  Return Value:
  37. //      None.
  38. //
  39.  
  40. global proc birailToolSetup( int $forceFactorySettings, string $goToTool )
  41. {
  42.     if( $forceFactorySettings || !`optionVar -ex birailEuc` ) {
  43.         optionVar -iv birailEuc 1;
  44.     }
  45.     if( $forceFactorySettings || !`optionVar -ex birailLac` ) {
  46.         optionVar -iv birailLac 1;
  47.     }
  48.     if( "" != $goToTool ) {
  49.         scriptCtx -e -euc `optionVar -q birailEuc` $goToTool;
  50.         scriptCtx -e -lac `optionVar -q birailLac` $goToTool;
  51.     }
  52. }
  53.  
  54. proc createBirailContext( int $whichOne, string $tool )
  55. {
  56.     birailToolSetup( 0, "" );
  57.     switch ($whichOne) {
  58.       case 1:
  59.         if( ! `scriptCtx -exists $tool` ) {
  60.           scriptCtx
  61.             -i1 "birail1Gen.xpm"
  62.             -bcn "birail1"
  63.  
  64.             -title "Birail 1 Tool"
  65.             -toolCursorType "edit" 
  66.             -totalSelectionSets 2
  67.             -cumulativeLists true
  68.             -expandSelectionList true
  69.             -exitUponCompletion `optionVar -q birailEuc`
  70.             -fcs ("performBirail 0 1 \`currentCtx\`")
  71.  
  72.             -setNoSelectionPrompt "Select the profile curve."
  73.             -setSelectionPrompt ("Profile curve selected.  " +
  74.                                  "Press ENTER to start rail selection.")
  75.             -setDoneSelectionPrompt ("Profile curve selected.  " +
  76.                                      "Press ENTER to start rail selection.")
  77.  
  78.             -setAutoToggleSelection true
  79.             -setAutoComplete true
  80.             -setSelectionCount 1
  81.             -nurbsCurve true
  82.             -isoparm true
  83.             -curveOnSurface true
  84.             -surfaceEdge true
  85.             -polymeshEdge true
  86.  
  87.             -setNoSelectionPrompt ("Profile curve selected. Select " +
  88.                                    "two rails curves.")
  89.             -setSelectionPrompt "Select the second rail curve."
  90.             -setDoneSelectionPrompt ("Profile and rail curves selected.  " +
  91.                                      "Press ENTER to compute birail.")
  92.             -setAutoToggleSelection true
  93.             -setAutoComplete `optionVar -q birailLac`
  94.             -setSelectionCount 2
  95.             -nurbsCurve true
  96.             -isoparm true
  97.             -curveOnSurface true
  98.             -surfaceEdge true
  99.             -polymeshEdge true
  100.  
  101.             $tool;
  102.         }
  103.         break;
  104.       case 2:
  105.         if( ! `scriptCtx -exists $tool` ) {
  106.           scriptCtx
  107.             -i1 "birail2Gen.xpm"
  108.             -bcn "birail2"
  109.  
  110.             -title "Birail 2 Tool"
  111.             -toolCursorType "edit" 
  112.             -totalSelectionSets 2
  113.             -cumulativeLists true
  114.             -expandSelectionList true
  115.             -exitUponCompletion `optionVar -q birailEuc`
  116.             -fcs ("performBirail 0 2 \`currentCtx\`")
  117.  
  118.             -setNoSelectionPrompt "Select two profile curves."
  119.             -setSelectionPrompt "Select the second profile curve."
  120.             -setDoneSelectionPrompt ("Two profile curves selected.  " +
  121.                                      "Press ENTER to start rail selection.")
  122.             -setAutoToggleSelection true
  123.             -setAutoComplete true
  124.             -setSelectionCount 2
  125.             -nurbsCurve true
  126.             -isoparm true
  127.             -curveOnSurface true
  128.             -surfaceEdge true
  129.             -polymeshEdge true
  130.  
  131.             -setNoSelectionPrompt "Select two rail curves."
  132.             -setSelectionPrompt "Select the second rail curve."
  133.             -setDoneSelectionPrompt ("Profile and rail curves selected.  " +
  134.                                      "Press ENTER to compute birail.")
  135.             -setAutoToggleSelection true
  136.             -setAutoComplete `optionVar -q birailLac`
  137.             -setSelectionCount 2
  138.             -nurbsCurve true
  139.             -isoparm true
  140.             -curveOnSurface true
  141.             -surfaceEdge true
  142.             -polymeshEdge true
  143.  
  144.             $tool;
  145.         }
  146.         break;
  147.       case 3:
  148.       default:
  149.         if( ! `scriptCtx -exists $tool` ) {
  150.           scriptCtx
  151.             -i1 "birail3Gen.xpm"
  152.             -bcn "birail3"
  153.  
  154.             -title "Birail 3+ Tool"
  155.             -toolCursorType "edit"        
  156.             -totalSelectionSets 2
  157.             -cumulativeLists true
  158.             -expandSelectionList true
  159.             -exitUponCompletion `optionVar -q birailEuc`
  160.             -fcs ("performBirail 0 3 \`currentCtx`")
  161.  
  162.             -setNoSelectionPrompt "Select any number of profile curves."
  163.             -setSelectionPrompt ("Select additional profiles or press " +
  164.                                  "ENTER to start rail curves selection.")
  165.             -setDoneSelectionPrompt ("Select additional profiles or press " +
  166.                                      "ENTER to start rail curves selection.")
  167.  
  168.             -setAutoToggleSelection true
  169.             -setAutoComplete false
  170.             -setSelectionCount 0
  171.             -nurbsCurve true
  172.             -isoparm true
  173.             -curveOnSurface true
  174.             -surfaceEdge true
  175.             -polymeshEdge true
  176.  
  177.             -setNoSelectionPrompt "Select two rail curves."
  178.             -setSelectionPrompt "Select the second rail curve."
  179.             -setDoneSelectionPrompt ("Profile and rail curves selected.  " +
  180.                                      "Press ENTER to compute birail.")
  181.             -setAutoToggleSelection true
  182.             -setAutoComplete `optionVar -q birailLac`
  183.             -setSelectionCount 2
  184.             -nurbsCurve true
  185.             -isoparm true
  186.             -curveOnSurface true
  187.             -surfaceEdge true
  188.             -polymeshEdge true
  189.  
  190.             $tool;
  191.         }
  192.         break;
  193.     }
  194. }
  195.  
  196. global proc string birailToolScript( int $setToTool, int $whichOne )
  197. //
  198. //    Description :
  199. //        $setToTool = 0 ==> do the command
  200. //        $setToTool = 1 ==> show option box
  201. //        $setToTool = 2 ==> return the command
  202. //        $setToTool = 3 ==> show tool option box
  203. //        $setToTool = 4 ==> enter the tool
  204. {
  205.     string $tool = "";
  206.     if( $setToTool > 2 ) {
  207.         switch( $whichOne ) {
  208.           case 1:
  209.             $tool = "birailOneProfileContext";
  210.             break;
  211.           case 2:
  212.             $tool = "birailTwoProfileContext";
  213.             break;
  214.           case 3:
  215.           default:
  216.             $tool = "birailThreePlusProfileContext";
  217.             break;
  218.         }
  219.         createBirailContext( $whichOne, $tool );
  220.     }
  221.  
  222.     string $result = "";
  223.     switch ($setToTool) {
  224.       case 4:
  225.         setToolTo $tool;
  226.         break;
  227.       default:
  228.         $result = eval( "performBirail " + $setToTool + " " +
  229.                         $whichOne + " \"" + $tool + "\"" );
  230.         break;
  231.     }
  232.     return $result;
  233. }
  234.